import 'package:flutter/material.dart';
import 'package:flutter3x/getx_controller/life_cycle_controller.dart';
import 'package:get/get.dart';

class LifeCycle extends StatelessWidget {
  const LifeCycle({super.key});

  @override
  Widget build(BuildContext context) {
    final LifeCycleController lifeCycleController =
        Get.put(LifeCycleController());

    return Scaffold(
        body: Align(
            alignment: Alignment.center,
            child: Container(
                width: 200,
                height: 200,
                alignment: Alignment.center,
                child: Column(children: [
                  Obx(() => Text(lifeCycleController.hotListStr.value)),
                  ElevatedButton(
                      onPressed: () {
                        lifeCycleController.getHotList();
                      },
                      child: const Text("按钮")),
                  ElevatedButton(
                      onPressed: () => {
                            Get.delete<LifeCycleController>(),
                          },
                      child: const Text("销毁")),
                  ElevatedButton(
                      onPressed: () => {Get.back()}, child: const Text("返回"))
                ]))));
  }
}
